if getattr(globals(), 'app', None) is None or wx.GetApp() is None:
app = wx.PySimpleApp()
app.ignoreSynchronizeWidget = True
try:
# Let's try the best (and most complicated) option
# first
# See if we already have a window up, and if so, reuse it
from application import feedback
feedback.destroyAppOnClose = True
win = feedback.FeedbackWindow()
win.CreateOutputWindow('')
for line in backtrace:
win.write(line)
if not app.IsMainLoopRunning():
app.MainLoop()
except:
# Fall back to our custom (but simple) error dialog
try:
from application.dialogs.UncaughtExceptionDialog import ErrorDialog
dialog = ErrorDialog(longMessage)
except:
# Fall back to MessageDialog
frames = 8
line = _(u"Start up error.\nHere are the bottom %(numOf)s frames of the stack: %(stacktrace)s\n\n") % {'numOf': frames - 1, "stacktrace": unicode("".join(backtrace[-frames:]), "UTF-8", "ignore")}